package ishaportalserver.apps.insight;

import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.QueryParam;

@Path("/member/")
public class MemberAPI {

	@GET
	@Path("/get/")
	public String getMatchingMembers(@QueryParam("searchstr") String searchStr, 
			@QueryParam("callback") String callback) {
						
		return "hello world from insight. searchstr = " + searchStr + 
				" callback = " + callback;				
	}
	
//	@GET
//	@Path("/{memberid}/")
//	public String getMember(@PathParam("memberid") long memberId, 
//			@QueryParam("callback") String callback) {					
//			
//		Repository r = new Repository();
//		
//		MemberEntity m = r.getMember(memberId);
//		
//		String json = "id [" + memberId + "] not found.";
//		if (null != m) {
//			json = new Gson().toJson(m);
//		}
//				
//		if (null != callback)
//			json = callback + "(" + json + ")";
//		
//		return json;
//	}
	
	@PUT	
	@Path("/save/")
	public String savePersonalDetails() {
		return "";
	}
	
	@PUT
	@Path("/addcenter/")
	public String addCenter(@QueryParam("memberid") Long memberId, 
			@QueryParam("centerid") Long centerId) {
		
		//to do - return error if center does not exist
		return "";
	}
	
	@PUT
	@Path("/removecenter/")
	public String removeCenter(@QueryParam("memberid") Long memberId, 
			@QueryParam("centerid") Long centerId) {
		
		//to do - return error if center does not exist in memberentity
		return "";
	}		
}
